recordsA = [3.14,
            0,
            2.99,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            3.13,
            0, 0, 0, 0, 0,
            3.2,
            3.5,
            3.18,
            3.52,
            0, 0,
            3.3,
            0, 0,
            3.1,
            3,
            0, 0, 0,
            3.04,
            0,
            3.65,
            2.97,
            0, 0, 0, 0, 0, 0,
            3.33,
            0,
            3.08]
recordsB = [
    0, 0, 0, 0, 0,
    3.2,
    3.5,
    3.18,
    3.52,
    0, 0,
    3.3,
    0, 0,
    3.1,
    3,
    0, 0, 0,
    3.04,
    0,
    3.65,
    2.97,
    0, 0, 0, 0, 0, 0,
    3.33,
    0,
    3.08]
using_records = recordsB
BASE = 100
planA = [1, 1, 2, 3, 5, 8, 12, 18, 28, 42, 65, 100]
planB = [1, 2, 4, 8, 12, 20, 30, 45, 68, 100, 160, 240]
planC = [1, 1, 2, 3, 5,8,12,20]
using_plan = planC


def run():
    count = len(using_records)
    day = 0
    n = 0
    day_bet = 0
    day_bonus = 0
    total_bet = 0
    total_bonus = 0
    profit = 0
    n_record = []
    using_money = 0
    using_money_record = []
    for day in range(0, len(using_records)):
        day_bet = using_plan[n % len(using_plan)] * BASE
        day_bonus = day_bet * using_records[day]
        total_bet += day_bet
        total_bonus += day_bonus
        profit = total_bonus - total_bet
        using_money += day_bet

        avg_n = 0
        if len(n_record) > 0:
            avg_n = round(sum(n_record) / len(n_record), 1)
        max_using_money = max(using_money_record) if len(using_money_record) > 0 else 0
        max_using_money = max(max_using_money, using_money)

        max_n = max(n_record) if len(n_record) > 0 else 0
        print(
            f"第{day}天,第{n+1}期,下注：{day_bet},使用:{using_money},中奖:{day_bonus},累计:{profit},      平均期数：{avg_n},最大使用:{max_using_money},最大天数：{max_n}")
        # 如果中了则从头开始计划
        if using_records[day] > 0:
            n_record.append(n + 1)
            n = 0
            using_money_record.append(using_money)
            using_money = 0
        else:
            n += 1

    pass


if __name__ == '__main__':
    run()
